<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>弹性布局-证明内容左右两端项目对齐间距(flex layout - justify content for left and right end item align spacing)</title>
  <!-- 
    在CSS的flex布局中，justify-content属性用于设置flex容器中flex项目沿主轴方向的对齐方式。
    justify-content属性的文字说明： 
 
      1. flex-start：默认值，flex项目沿主轴起点对齐。 
      2. flex-end：flex项目沿主轴末尾对齐。 
      3. center：flex项目沿主轴居中对齐。 
      4. space-between：flex项目均匀分布在主轴上，首尾项目与容器边缘对齐。 
      5. space-around：flex项目均匀分布在主轴上，项目之间及首尾项目与容器边缘之间的间距相等。 
   -->
  <style>
    .container {
      display: flex;
      background-color: skyblue;
      width: 400px;
      height: 200px;
    }

    .item {
      width: 80px;
      height: 100px;
    }
  </style>
  <style>
    /* flex-start - 沿主轴起点对齐  */
    .display-flex-justify-content-flex-start {
      /* justify-content - 控制flex项目沿主轴方向的对齐间距方式
          flex-start - 沿主轴起点对齐 
      */
      justify-content: flex-start;
    }

    /* flex-end - 沿主轴末尾对齐 */
    .display-flex-justify-content-flex-end {
      /* justify-content - 控制flex项目沿主轴方向的对齐间距方式
          flex-end - 沿主轴末尾对齐
      */
      justify-content: flex-end;
    }

    /* center - 居中对齐  */
    .display-flex-justify-content-center {
      /* justify-content - 控制flex项目沿主轴方向的对齐间距方式
          center - 居中对齐
      */
      justify-content: center;
    }

    /* space-around - 周围的空间  */
    .display-flex-justify-content-space-around {
      /* justify-content - 控制flex项目沿主轴方向的对齐间距方式
          space-around - 项目均匀分布在主轴上，项目之间及首尾项目与容器边缘之间的间距相等
      */
      justify-content: space-around;
    }

    /* space-between - 之间的空间  */
    .display-flex-justify-content-space-between {
      /* justify-content - 控制flex项目沿主轴方向的对齐间距方式
          space-between - 项目均匀分布在主轴上，首尾项目与容器边缘对齐
      */
      justify-content: space-between;
    }
  </style>
</head>
<body>

  <h3>1. justify-content: flex-start - 沿主轴起点对齐</h3>
  <div class="container display-flex-justify-content-flex-start">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>

  <h3>2. justify-content: flex-end - 沿主轴末尾对齐</h3>
  <div class="container display-flex-justify-content-flex-end">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>

  <h3>3. justify-content: center - 居中对齐</h3>
  <div class="container display-flex-justify-content-center">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>

  <h3>4. justify-content: space-around - 项目均匀分布在主轴上，首尾项目与容器边缘对齐</h3>
  <div class="container display-flex-justify-content-space-around">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>

  <h3>5. justify-content: space-between - 项目均匀分布在主轴上，项目之间及首尾项目与容器边缘之间的间距相等</h3>
  <div class="container display-flex-justify-content-space-between">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>

 <script src="./js/itemRandomColor.js"></script>

</body>
</html>